package org.example.controller;

import org.example.entry.UserInfo;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;

/**
 * Created with IntelliJ IDEA 2023.
 * Description:
 * User: homechen
 * Date: 2024-03-31
 * Time: 12:49
 */
@Controller
public class UserBean {
    //    @Bean(name="user2")
    @Bean("user1")
    public UserInfo userInfo1() {
        UserInfo userInfo = new UserInfo();
        userInfo.setId(1);
        userInfo.setAge(20);
        userInfo.setName("张三");
        return userInfo;
    }
    @Bean("user2")
    public UserInfo userInfo2() {
        UserInfo userInfo = new UserInfo();
        userInfo.setId(2);
        userInfo.setAge(30);
        userInfo.setName("小三");
        return userInfo;
    }
}
